<?php
/*
 * Copyright 2013 by Jerrick Hoang, Ivy Xing, Sam Roberts, James Cook, 
 * Johnny Coster, Judy Yang, Jackson Moniaga, Oliver Radwan, 
 * Maxwell Palmer, Nolan McNair, Taylor Talmage, and Allen Tucker. 
 * This program is part of RMH Homebase, which is free software.  It comes with 
 * absolutely no warranty. You can redistribute and/or modify it under the terms 
 * of the GNU General Public License as published by the Free Software Foundation
 * (see <http://www.gnu.org/licenses/ for more information).
 * 
 */

session_start();
session_cache_expire(30);
?>
<html>
    <head>
        <title>
            Search for Clinicians
        </title>
        <link rel="stylesheet" href="styles.css" type="text/css" />
    </head>
    <body>
        <div id="container">
            <?PHP include('header.php'); ?>
            <div id="content">
                <?PHP
                		// display the search form
                $area = $_GET['area'];
                echo('<form method="post">');
                echo '<fieldset>
			<legend>Search for Clinicians: </strong> </legend>
                            <table><tr>
                            </tr>';
              
                echo '<br><input type="radio" name="searchStr" value="1">';
		echo ' Name:<input type="text" name="name">';
		echo '<br><input type="radio" name="searchStr" value="2">';
		echo ' NPI:<input type="text" name="npi">';
                echo '<br><input type="radio" name="searchStr" value="3">';
		echo ' Specialty:<input type="text" name="specialty">';
     
                echo '</table></fieldset>';

                echo('<p><input type="hidden" name="s_submitted" value="1"><input type="submit" name="Search" value="Search">');
                echo('</form></p>');
				
		// if user hit "Search"  button, query the database and display the results
				
		if ($_POST['s_submitted'])
                {
                    include_once('database/dbClinician.php');
                    include_once('domain/Clinician.php');
				
                    $radioChoice = $_GET("radioChoice"); 
                                        if ($radioChoice == 1) {
						$searchString = $_GET("name");
						$result = retrieve_clinician_by_name($searchString);
						//echo(result);
                                                echo '<p><strong>Search Results:</strong> <p>Found ' . sizeof($result) . ' ' . $status . ' ';
					}
					else if ($radioChoice == 2) {
						$searchString = $_GET("npi");
						$result = retrieve_clinician_by_npi($searchString);
						echo(result);
					}
					else if ($radioChoice == 3) {
						$searchString = $_GET("specialty");
						$result = retrieve_clinician_by_specialty($searchString);
						echo(result);
					}
				}
                ?>
                <!-- below is the footer that we're using currently-->
                </div>
        </div>
        <?PHP include('footer.inc'); ?>
    </body>
</html>